package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.system.utils.PdfBoxGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/system/pdf")
public class PdfController {
    @Autowired
    private PdfBoxGenerator pdfBoxGenerator;

//    @Anonymous
//    @GetMapping("/simple")
//    public ResponseEntity<byte[]> generateSimplePdf() throws IOException {
//        byte[] pdfBytes = pdfBoxGenerator.createSimplePdf("测试文档", "这是一个简单的PDF文档内容");
//
//        return ResponseEntity.ok()
//                .header("Content-Disposition", "attachment; filename=simple.pdf")
//                .contentType(MediaType.APPLICATION_PDF)
//                .body(pdfBytes);
//    }
}
